home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Menus.c
-
- Contains: Handles the application's menus
-
- Written by: Chris White, Developer Technical Support
-
- Copyright: © 1996 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- 03/29/96 CW First release
-
- */
-
-
- #pragma segment Core
-
-
- #ifndef __MENUS__
- #include <Menus.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __TEXTUTILS__
- #include <TextUtils.h>
- #endif
-
- #ifndef __DESK__
- #include <Desk.h>
- #endif
-
-
-
-
-
- // Application includes
-
- #ifndef __BAREBONES__
- #include "BareBones.h"
- #endif
-
- #ifndef __PROTOTYPES__
- #include "Prototypes.h"
- #endif
-
-
-
-
- static void DoAppleCmds ( SInt16 theItem );
- static void DoFileCmds ( SInt16 theItem );
-
-
-
-
-
- void MenuDispatch ( SInt32 menuResult )
- {
- SInt16 theMenu = (menuResult >> 16); // menu selected
- SInt16 theItem = (menuResult & 0x0000FFFF); // item selected
-
- switch (theMenu)
- {
- case kAppleMenu:
- DoAppleCmds ( theItem );
- break;
-
- case kFileMenu:
- DoFileCmds ( theItem );
- break;
-
- }
-
- HiliteMenu ( 0 ); // un-hilite selected menu
-
- return;
-
- } // MenuDispatch
-
-
-
- static void DoAppleCmds ( SInt16 theItem )
- {
- Str255 name; // string for DA name
-
-
- switch ( theItem )
- {
- case cAbout:
- DoAboutBox ( );
- break;
-
- default:
- GetItem ( GetMHandle ( kAppleMenu ), theItem, (StringPtr) &name );
- OpenDeskAcc ( (StringPtr) &name );
- break;
- }
- }
-
-
-
- static void DoFileCmds ( SInt16 theItem )
- {
- switch ( theItem )
- {
- case cQuit:
- gQuit = true;
- break;
- }
-
- return;
-
- } // DoFileCmds
-
-
-
-